package com.qianzhou.eduCourseBoot.converter;

import com.qianzhou.eduCommon.bo.CourseSectionBO;
import com.qianzhou.eduCommon.dto.CourseSectionDTO;
import com.qianzhou.eduCommon.po.CourseLesson;
import com.qianzhou.eduCommon.po.CourseSection;
import com.qianzhou.eduCommon.vo.CourseLessonVO;
import com.qianzhou.eduCommon.vo.CourseSectionVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface CourseSectionConverter {
    CourseSectionConverter INSTANCE = Mappers.getMapper(CourseSectionConverter.class);

    /**
     * CourseConverter 将对应的CourseSectionBO转换为对应的CourseSectionVO
     */
    List<CourseSectionVO> boListConvertVoList(List<CourseSectionBO> courseSectionBOS);

    /**
     * 将对应的CourseSectionVO转换为对应的CourseSectionBo
     */
    List<CourseSectionBO> voListConvertBoList(List<CourseSectionVO> courseSectionVOS);

    /**
     * 将对应的courseLesson转换为对应的CourseLessonVO
     */
    List<CourseLessonVO> poListConvertVoList(List<CourseLesson> courseLessons);
    @Mappings({
            @Mapping(source = "courseLesson.", target = ".")
    })
    CourseLessonVO poConvertVo(CourseLesson courseLesson);

    /**
     * 将对应的dto转换为po
     */
    CourseSection dtoConvertPo(CourseSectionDTO courseSectionDTO);

    CourseSectionVO poConvertVoSection(CourseSection courseSection);
}
